package com.luo.testtouch.publicview;

import android.R.bool;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ScrollView;

/**
 * 
 * @author noahedu
 *
 */
public class MyScrollViewOrNot extends ScrollView {

	private static final String LOCAL = "MyScrollViewOrNot";
	private static final String TAG = "MyScrollView ";
	/**
	 * ？
	 */
	private boolean mcanScroll;

	/**
	 * @param context
	 */
	public MyScrollViewOrNot(Context context) {
		super(context);
	}

	
	
	/**
	 * 布局文件中用
	 * 
	 */
	public MyScrollViewOrNot(Context context, AttributeSet attrs) {
		super( context,  attrs);
	}
	
	
	@Override
	public boolean onTouchEvent(MotionEvent ev) {
//		if(!mcanScroll ){
//			return false ;
//		}else{
////			return true ;
//		}
		
		Log.i(GUitl.Log_TAG, LOCAL +"-----onTouchEvent enter");
		boolean res = super.onTouchEvent(ev);
		
		
		Log.i(GUitl.Log_TAG, LOCAL +"-----onTouchEvent==="+res);
		return res;
	}
	
	
	@Override
	public boolean dispatchTouchEvent(MotionEvent ev)
	{
		Log.i(GUitl.Log_TAG, LOCAL +"-----dispatchTouchEvent enter");
		boolean res = super.dispatchTouchEvent(ev);
		
		Log.i(GUitl.Log_TAG, LOCAL +"-----dispatchTouchEvent---"+res);
		
		
		return res;
	}
	
	
	
	@Override
	public boolean onInterceptTouchEvent(MotionEvent ev) {
		
		Log.i(GUitl.Log_TAG, LOCAL +"-----onInterceptTouchEvent enter");
		boolean resFlag = false ;
//		if(mcanScroll ){
////			ev.getAction()
//			resFlag = true ;
//		}else{
//			Log.i("luo_debug", TAG+" onInterceptTouchEvent********");
////			return false ;
//		}
		
		resFlag = super.onInterceptTouchEvent(ev);
		
		
		Log.i(GUitl.Log_TAG, LOCAL +"-----onInterceptTouchEvent==="+resFlag);
		return resFlag;
	}
	
	
	
	
	

	/**
	 * 
	 *@param canScroll
	 */
	public void setScrollable(boolean canScroll)
	{
		mcanScroll = canScroll ;
	}
	/**
	 * 获得滑动了多少？
	 */
	public int getScrollOffsetY() {
		return super. computeVerticalScrollOffset();

	}
}
